import 'package:faker/common/config.dart';
import 'package:faker/i18n/i18n.dart';
import 'package:faker/models/models.dart';
import 'package:faker/res/style.dart';
import 'package:faker/widgets/com_item.dart';
import 'package:flutter/material.dart';

/// 关于界面
class AboutScreen extends StatelessWidget {
  ComModel version =
      new ComModel(title: '版本号', extra: AppConfig.version, isShowArrow: false);
  ComModel officialAddress = new ComModel(
      title: '官方网站',
      subtitle: 'club.yutaozhou.com',
      url: 'https://club.yutaozhou.com',
      extra: '',
      isShowArrow: true);
  /*
  ComModel github = new ComModel(
      title: '项目源码',
      subtitle: '',
      url: '',
      extra: '',
      isShowArrow: true);
   */
  ComModel updateLogs = new ComModel(
      title: '初始版本',
      url: 'https://github.com/iceCola7/flutter_wanandroid/releases',
      extra: '',
      isShowArrow: true);
  ComModel copyright =
      new ComModel(title: '版权声明', extra: '仅作个人及非商业用途', isShowArrow: true);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: new ListView(
        children: <Widget>[
          new Container(
            height: 300.0,
            alignment: Alignment.center,
            child: new Column(
              mainAxisAlignment: MainAxisAlignment.center,
              mainAxisSize: MainAxisSize.min,
              children: <Widget>[
                Padding(
                  padding: const EdgeInsets.all(30),
                  child: Text(
                    S.of(context).about,
                    style: TextStyle(
                      color: Theme.of(context).textSelectionColor,
                      fontSize: 32.0,
                      fontFamily: fontName,
                      letterSpacing: 1.0,
                    ),
                  ),
                ),
                new Card(
                  color: Theme.of(context).primaryColor,
                  elevation: 0.0,
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.all(Radius.circular(6.0))),
                  child: new Image.asset(
                    "assets/images/logo.png",
                    width: 72.0,
                    fit: BoxFit.fill,
                    height: 72.0,
                  ),
                ),
                Gaps.vGap10,
                new Text(
                  AppConfig.appName,
                  style: new TextStyle(fontSize: 20),
                ),
              ],
            ),
            decoration: Decorations.bottom,
          ),
          new ComArrowItem(version),
          new ComArrowItem(officialAddress),
          //new ComArrowItem(github),
          //new ComArrowItem(updateLogs),
          new ComArrowItem(
            copyright,
            onClick: () {
              showDialog(
                  context: context,
                  builder: (context) => AlertDialog(
                        title: Text('版权声明'),
                        content: Text(('本App所仅供学习交流')),
                      ));
            },
          ),
        ],
      ),
    );
  }
}
